<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script>
		
		document.write("<table>");

			for (var i = 1; i <= 9; i++) {
				document.write("<tr>");
				for (var k = 1; k <= i; k++) {
					
					if(k%2==1){
						document.write("<td style='background:red'>"+k+"*"+i+"="+(i*k)+"</td>");
					}else if(i%2==0){
						document.write("<td style='background:gray'>"+k+"*"+i+"="+(i*k)+"</td>");
					}else{
						document.write("<td style='background:blue'>"+k+"*"+i+"="+(i*k)+"</td>");
					}
					
				}
				document.write("</tr>");
			}

		document.write("</table>");
	</script>
</head>
<body>
	
</body>
</html>